#ifndef ABSTRACTRESULT_H
#define ABSTRACTRESULT_H

#include <QObject>
#include <QVariant>
#include "result-error.h"

class QMutex;

class AbstractResult : public QObject
{
    Q_OBJECT
public:
    explicit AbstractResult(QObject *parent = 0);
    ~AbstractResult();

    bool hasError() const;
    ResultError error() const;
    QVariant requestData() const;

public slots:
    void setError (const QString& errorText, int errorCode = 0);
    void setError (const ResultError& error);
    void setRequestData (const QVariant& requestData);

protected:
    virtual void emitResultReady() = 0;

    ResultError m_error;
    QVariant m_requestData;
    QMutex* m_mutex;
};

#endif // ABSTRACTRESULT_H
